import { da } from "element-plus/es/locale"


let state: {
operateAction:string,
markList:any [],
markIndex:number |null,
activeMark:{
  x:null| number,
  y:null| number,
  w:null| number,
  h:null| number,
  color:string,
  labelId:string | number,
  name:string
},
percentage:number,
createOrMove:string,
markColor:string,
labelId:string | number,
labelName:string,
scale:number,
copyList:any [],
autoLabel:boolean,
photoListId:number|string,
artificial:boolean,
dialogVisibleArtificial:boolean,
routerName:string

} = {
    operateAction:'',
    markList:[],//标注框坐标数组
    markIndex:null,
    activeMark:{
      x:null,
      y:null,
      w:null,
      h:null,
      color:'',
      labelId:'',
      name:""
    } ,// 选中的标注框坐标
    percentage:1000,
    createOrMove:'',
    markColor:'',
    labelId:'',
    labelName:'',
    scale:1,//缩放倍数
    copyList:[],
    photoListId:'',
    autoLabel:false,
    artificial:false,
    dialogVisibleArtificial:false,
    routerName:''

}

let getters = {

}
let mutations = {
editOperate(state:any,val:string){
  state.operateAction=''
  state.operateAction=val
},
updateMarkList(state:any,list:any[]){
  state.markList=[]
  let data=JSON.parse(JSON.stringify(list))
  console.log(da)
  state.markList=data
},
updateMarkIndex(state:any,index:number){
  state.markIndex=null
state.markIndex=index
},
updateActiveMark(state:any,val:any){
  state.activeMark=val
},
updatePercentage(state:any,val:number){
  let percentage =1000
  let per = val / 100
  state.percentage=percentage / per
},
updateCreateOrMove(state:any,val:string){
  state.createOrMove=''
  state.createOrMove=val
},
updateLable(state:any,val:{markColor:string,labelId:string | number,labelName:string}){
  state.markColor=val.markColor
  state.labelId=val.labelId
  state.labelName=val.labelName
},
updateScale(state:any,val:number){
  state.scale=1
  state.scale=val
},
updateCopyList(state:any,val:any[]){
  state.copyList=[]
  let data=JSON.parse(JSON.stringify(val))
  state.copyList=data
},
updateAutoLabel(state:any,val:boolean){
  state.autoLabel=val
},
updatePhotoListId(state:any,val:boolean){
  state.photoListId=val
},
markListLength(state:any,val:number){
  state.markList.length=val
},
updateDialogVisibleArtificial(state:any,val:boolean){
  state.dialogVisibleArtificial=val
},
updateArtificial(state:any,val:boolean){
  state.artificial=val
},
updateRouterName(state:any,val:string){
  state.routerName=val
},

}
let actions = {

}
export default {
  namespaced: true,
  state,
  getters,
  mutations,
  actions
}
